home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9075 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: castle.nando.net!news
  2. From: actuary@nando.net   (Bill McCarthy)
  3. Newsgroups: gnu.gcc.help,comp.lang.c
  4. Subject: Re: gcc 2.7.2 warning: left-hand operand of comma expression has no effect
  5. Date: 8 Mar 1996 03:48:57 GMT
  6. Organization: Nando.net Public Access
  7. Message-ID: <4hoan9$eav@castle.nando.net>
  8. References: <313DEA09.237C@tulsa.lgc.com>
  9. Reply-To: actuary@nando.net (Bill McCarthy)
  10. NNTP-Posting-Host: grail2314.nando.net
  11. X-Newsreader: IBM NewsReader/2 v1.2
  12.  
  13. In <313DEA09.237C@tulsa.lgc.com>,
  14. Glenn Carr <gcarr@tulsa.lgc.com> writes:
  15.  
  16. >We've just moved from gcc 2.6.3 to 2.7.2 and we're receiving the following new
  17. >warnings (when -Wall is specified)....
  18. >
  19. >warning: left-hand operand of comma expression has no effect
  20. >
  21. >When this section of code is encountered in our source files...
  22. >
  23. >static char    *rcsid = "$Id: cfgopen.c,v 1.4 1995/12/11 16:04:35 gcarr Exp $";
  24. >#if __GNUC__ == 2
  25. >#define USE(var) static void * use_##var = (&use_##var, (void *) &var)
  26. >USE(rcsid);
  27. >#endif
  28.  
  29. Isn't comma in the #define is a comma operator?  Then you are taking the
  30. address of use_rcsid and discarding it.  What will be returned to use_rcsid
  31. is the address of rcsid (a char **) cast to a (void *).
  32.  
  33. Bill McCarthy
  34. actuary@nando.net
  35. Wendell, NC  USA
  36.  
  37.